﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Profile;

namespace WebSite.admin.product
{
    public partial class comment_manage_add1 : BaseAdmin
    {


        // Methods
        private void Bind()
        {
            DataTable table = SQLAccess.GreatDs("select * from DB_Comment1 where commentid=" + re.replace(base.Request.QueryString["cid"]) + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                if (table.Rows[0]["memberid"].ToString() == "0")
                {
                    this.member.Text = "匿名用户";
                }
                else
                {
                    DataTable table2 = SQLAccess.GreatDs("select * from DB_Member where memberid=" + table.Rows[0]["memberid"].ToString() + "").Tables[0];
                    if (table2.Rows.Count > 0)
                    {
                        this.member.Text = table2.Rows[0]["memberlogin"].ToString();
                    }
                }
                DataTable table3 = SQLAccess.GreatDs("select * from DB_Shoppro where proid=" + table.Rows[0]["proid"].ToString() + "").Tables[0];
                if (table3.Rows.Count > 0)
                {
                    this.pro.Text = "<a href=" + fun.geturl1("") + "products_details.aspx?categoryid=" + re.webinfo2("", table3.Rows[0]["typeid"].ToString(), info.languages("")) + "&typeid=" + table3.Rows[0]["typeid"].ToString() + "&pid=" + table3.Rows[0]["proid"].ToString() + " target='_blank'>" + table3.Rows[0]["proname"].ToString() + "</a>";
                }
                this.updatetime.Text = table.Rows[0]["updatetime"].ToString();
                this.content.Text = table.Rows[0]["content"].ToString();
                this.ipadd.Text = table.Rows[0]["ipadd"].ToString();
                this.replays.Text = table.Rows[0]["replay"].ToString();
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            SQLAccess.DoSql(string.Concat(new object[] { "update DB_Comment1 set replay='", re.replace(base.Request.Form["replays"]), "',states=1,replaytime='", DateTime.Now, "' where commentid=", re.replace(base.Request.QueryString["cid"]), "" }));
            base.Response.Write("<script language='javascript'>window.location.href='comment_manage_add1.aspx?cid=" + base.Request.QueryString["cid"] + "';</script>");
            base.Response.End();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (base.Request.QueryString["cid"] != null)
            {
                this.Bind();
            }
        }

     
    }
}